<%@ page contentType="text/html; charset=utf-8" %>
<ul id="tree" ></ul>
<script language="javascript">
$(function(){
	var treeData= [{   
    "id": 1,   
    "text": "人员管理",   
    "state": "closed",   
    "children": [{   
        "id": 11,   
        "text": "人员列表",
        attributes:{url:"${pageContext.request.contextPath}/person/list.do"}
    },{   
        "id": 12,   
        "text": "人员添加",
         attributes:{url:"${pageContext.request.contextPath}/person/toInsertPage.do"} 
    }]   
},{   
    "id": 2,   
    "text": "用户管理",   
    "state": "open",
    attributes:{url:"${pageContext.request.contextPath}/user/gotoList.do"} 
}];
	
	$('#tree').tree({   
   		 data:treeData,
   		 lines:true,
			onClick:function(node){
				if(node.attributes){
					$('#mainPanel').panel({  
					    href:node.attributes.url,   
					    onLoad:function(){   
					        //alert('loaded successfully');   
					    }   
					}); 
					//openTab(node.text,node.attributes.url);
				}
			}
	}); 
	
	// 新增Tab
	function openTab(text,url){
		if($("#tabs").tabs('exists',text)){
			$("#tabs").tabs('select',text);
		}else{
			var content="<iframe frameborder='0' scrolling='auto' style='width:100%;height:100%' src="+url+"></iframe>";
			$("#tabs").tabs('add',{
				title:text,
				closable:true,
				content:content
			});
		}
	} 
});	
</script>